import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { WorkorderSecondDispatchVO, WorkorderSecondDispatchForm, WorkorderSecondDispatchQuery } from '@/api/workorder/workorderSecondDispatch/types';

/**
 * 查询二次派单列表
 * @param query
 * @returns {*}
 */

export const listWorkorderSecondDispatch = (query?: WorkorderSecondDispatchQuery): AxiosPromise<WorkorderSecondDispatchVO[]> => {
  return request({
    url: '/workorder/workorderSecondDispatch/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询二次派单详细
 * @param id
 */
export const getWorkorderSecondDispatch = (id: string | number): AxiosPromise<WorkorderSecondDispatchVO> => {
  return request({
    url: '/workorder/workorderSecondDispatch/' + id,
    method: 'get'
  });
};

/**
 * 新增二次派单
 * @param data
 */
export const addWorkorderSecondDispatch = (data: WorkorderSecondDispatchForm) => {
  return request({
    url: '/workorder/workorderSecondDispatch',
    method: 'post',
    data: data
  });
};

/**
 * 修改二次派单
 * @param data
 */
export const updateWorkorderSecondDispatch = (data: WorkorderSecondDispatchForm) => {
  return request({
    url: '/workorder/workorderSecondDispatch',
    method: 'put',
    data: data
  });
};

/**
 * 删除二次派单
 * @param id
 */
export const delWorkorderSecondDispatch = (id: string | number | Array<string | number>) => {
  return request({
    url: '/workorder/workorderSecondDispatch/' + id,
    method: 'delete'
  });
};
